/***********************************************************************************
*	File: CreditState.cpp
*	Author: Keisuke Miyazaki
*	Project: Straw Man
*	Date: 09/13/2013
***********************************************************************************/
#include "CreditState.h"
#include "MainMenuState.h"
#include "../Game.h"

#include "../../SGD Wrappers/CSGD_Direct3D.h"
#include "../../SGD Wrappers/CSGD_DirectInput.h"
#include "../../SGD Wrappers/CSGD_TextureManager.h"
#include "../../SGD Wrappers/CSGD_XAudio2.h"
#include "../../SGD Wrappers/SGD_String.h"

#include "../BitmapFont/BitmapFont.h"

#define TM CSGD_TextureManager::GetInstance()
#define D3 CSGD_Direct3D::GetInstance()
#define XA CSGD_XAudio2::GetInstance()

#define White				D3DCOLOR_ARGB( 255, 255, 255, 255 )
#define Black				D3DCOLOR_ARGB( 255, 0, 0,	0 )
#define White_Highlight		D3DCOLOR_ARGB( 50, 255, 255, 255 )
#define Black_Highlight		D3DCOLOR_ARGB( 145,	0,	0,	0,	)
#define Red					D3DCOLOR_ARGB( 255, 255, 0,	0	)
#define Red1				D3DCOLOR_ARGB( 255, 204, 0,	0	)
#define Green				D3DCOLOR_ARGB( 255, 0, 255, 0	)
#define Blue				D3DCOLOR_ARGB( 255, 0,	0,	255 )
#define Blue2				D3DCOLOR_ARGB( 255, 0,	51, 102 )
#define Blue3				D3DCOLOR_ARGB( 255, 18,	52,	86	)
#define Orange				D3DCOLOR_ARGB( 255, 255, 165, 44 )

CCreditState* CCreditState::s_pInstance;
CCreditState* CCreditState::GetInstance( void )
{
	if( s_pInstance == nullptr )
		s_pInstance = new CCreditState;

	return s_pInstance;
}
void CCreditState::DeleteInstance( void )
{
	delete s_pInstance;
	s_pInstance = nullptr;
}

CCreditState::CCreditState(void)
{
}

void CCreditState::Enter( void )
{
}

void CCreditState::Exit( void )
{
	DeleteInstance();
}

bool CCreditState::Input( void )
{
	CSGD_DirectInput* pDI = CSGD_DirectInput::GetInstance();

	if( pDI->KeyDown( DIK_ESCAPE ) == true )
	{
		CGame::GetInstance()->ChangeState( CMainMenuState::GetInstance() );
	}

	return true;
}

void CCreditState::Update( float fElapsedTime )
{

}

void CCreditState::Render( void )
{
	D3->Clear( Black );

	RECT rBorder;

	rBorder.left	= 100;
	rBorder.top		= 190;
	rBorder.right	= 600;
	rBorder.bottom	= 400;

	D3->DrawRect( rBorder, White_Highlight );
	D3->DrawHollowRect( rBorder );
	

	D3->DrawText( _T("Software Game Programming September 2013"), 5, 5, White );

	TOSTRINGSTREAM sCredits;

	sCredits << "Associate Producer: Shawn Paris\n\n" 
			<< "Tile Editor: Roberto Crespo" << "\n"
			<< "Architecture and Design: Keisuke Miyazaki\n"
			<< "Particles: Mitchel Mishiev\n"
			<< "Animation: Jake Elmi";

	D3->DrawText(sCredits.str().c_str(),	110, 200, White );

	D3->DrawText( _T("Press Escape to Exit"), 300, 550, White );
}




